<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>知识点掌握热力图</title>
    <style>
        .card {
            display: inline-block;
            width: 100px;
            height: 100px;
            margin: 10px;
            text-align: center;
            line-height: 100px;
            font-weight: bold;
            color: white;
        }
        .green { background-color: green; }
        .yellow { background-color: gold; }
        .red { background-color: red; }
    </style>
</head>
<body>
<h1>知识点掌握热力图</h1>
<div id="heatmap"></div>

<script>
    const userId = 'user123'; // 示例用户ID
    fetch(`http://localhost:8086/knowledge-progress/heatmap/${userId}`)
        .then(response => response.json())
        .then(data => {
            const container = document.getElementById('heatmap');
            for (const [kpName, color] of Object.entries(data)) {
                const card = document.createElement('div');
                card.className = `card ${color}`;
                card.textContent = kpName;
                container.appendChild(card);
            }
        });
</script>
</body>
</html>